package com.liudadan.dao.impl;

import com.liudadan.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class StudentDaoImpl implements StudentDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void updateNameById(String name, Integer id) {
        String sql = "update studb.students set name=? where id=?";
        int update = jdbcTemplate.update(sql, name, id);
        System.out.println("update = " + update);
    }

    @Override
    public void updateGenderById(String gender, Integer id) {
        String sql = "update studb.students set gender=? where id=?";
        int update = jdbcTemplate.update(sql, gender, id);
        System.out.println("update = " + update);
    }
}
